package com.lw.behavioral.command;

import com.lw.behavioral.command.ord.BuyStock;
import com.lw.behavioral.command.ord.SellStock;

public class CommandPatternDemo {
   public static void main(String[] args) {
      Stock abcStock = new Stock();//创建一次股票的操作行为
 
      BuyStock buyStockOrder = new BuyStock(abcStock);//买单
      SellStock sellStockOrder = new SellStock(abcStock);//卖单
 
      Broker broker = new Broker();
      broker.takeOrder(buyStockOrder);//在构造中选择响应的命令作为参数，让平台帮我们操作命令
      broker.takeOrder(sellStockOrder);

      //这里，就如同选择买单100，但是最后还要进行确定下单（支付）操作
      broker.placeOrders();
   }
}